package cn.lf.constant;

import lombok.extern.slf4j.Slf4j;

import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Properties;

/**
 * minio配置常量
 * @author guoyy
 */
@Slf4j
public class MinioConstants {

    public static String MINIO_ENDPOINT;
    public static String MINIO_ACCESS_KEY;
    public static String MINIO_SECRET_KEY;
    public static String MINIO_BUCKET_NAME;

    static {

        Properties properties = new Properties();

        try {

            InputStream inputStream = MinioConstants.class.getClassLoader().getResourceAsStream("minio.properties");

            properties.load(new InputStreamReader(inputStream,"utf-8"));

            MINIO_ENDPOINT = properties.getProperty("minio.endPoint");

            MINIO_ACCESS_KEY = properties.getProperty("minio.accessKey");

            MINIO_SECRET_KEY = properties.getProperty("minio.secretKey");

            MINIO_BUCKET_NAME = properties.getProperty("minio.bucketName");

        }catch (Exception e){

            log.error("组装Minio常量失败："+e.getMessage());

        }
    }
}
